<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<input type="button" value="本地ajax" onclick="AjaxRequest()" />
<div id="request_times" ></div>
<script type="text/javascript" src="jquery-2.1.4.min.js"></script>
<script type="text/javascript">
    function AjaxRequest(){
        $.ajax({
            url:'/ajax_request/',   //发送到django程序
            type:'GET',
            data:{"k1":"v1","k2":"v2"},
            success:function(data){
                //当请求成功，并从远程获取返回值；如果返回的是字典，浏览器自动json解析;
                console.log(data);
                //显示在网页上
                $("#request_times").append(data);
            },
            error:function(){

            }
        })
    }
</script>
</body>
</html>